<?xml version="1.0" encoding="utf-8"?>
<taskrunner name="language.install" version="1.2" date="2008-10-28" maxthreads="1">

  <!-- Script for installation of new language. 
  
    This will happen:
    01. the global property ¤{install.type} will be set to LANGUAGE
    02.    
  
  
    Change Log:
    Date          CDSID     REQ/DEF     Comment
    2012-11-21    teriks28  4117        Added task "update.localdatabases" to run update scripts
	2013-10-29 : teriks28 : WAS8 project
				Removed task "add.servicerepository", we don´t have to update this file, it will be checked in at the correct location containing all possible databases
  -->
  
  <includes>
    <file name="vida.install.settings.xml" />
  </includes>

  

  <tasks>

    <task name="set.main.install.type" typename="@SetGlobalProperty">
      <description>
        Sets the global property main.install.type to INSTALL.
        This value will not change during the reinstallation.
      </description>
      <dependencies list=""/>
      <parameters>
        <parameter name="property.name" value="main.install.type"/>
        <parameter name="property.value" value="INSTALL"/>
      </parameters>
    </task>

    <task name="set.install.type">
      <description>
       Sets the global property install.type to LANGUAGE.
      </description>
      <dependencies list="set.main.install.type"/>
      <subtasks filename="vida.setinstalltype.xml">
        <parameters>
          <parameter name="install.type" value="LANGUAGE"/>
        </parameters>
      </subtasks>
    </task>

    
    <task name="copy.dbutilities">
      <dependencies list="set.install.type"/>
      <subtasks filename="vida.update.files.xml"/>
    </task>

    <task name="stop.sqlexpress.service" typename="@WindowsServiceCommand" retry="3">
      <dependencies list=""/>
      <parameters>
        <parameter name="server.name" value=""/>
        <parameter name="service.name" value="MSSQL$${sqlserver.instance.name}"/>
        <parameter name="command" value="stop"/>
      </parameters>
    </task>

    <task name="unzip.databases">
      <description>
        Unzips all databases except AccessServer and DiagSwdlSession. Further the
        imagerepository database will not be copied from installation source to target!
      </description>
      <dependencies list="stop.sqlexpress.service,set.install.type"/>
      <subtasks filename="vida.unzip.databases.xml"/>
    </task>
    
    
    <task name="start.sqlexpress.service" typename="@WindowsServiceCommand" retry="3">
      <dependencies list="unzip.databases"/>
      <parameters>
        <parameter name="server.name" value=""/>
        <parameter name="service.name" value="MSSQL$${sqlserver.instance.name}"/>
        <parameter name="throwException" value="false"/>
        <parameter name="command" value="start"/>
      </parameters>
    </task>


    <task name="SetAccessRule" typename="@AccessControl">
      <dependencies list="unzip.databases"/>
      <parameters>
        <parameter name="user" value="${sqlserver.service.account}"/>
        <parameter name="folder" value="${target.db.dir}"/>
      </parameters>
    </task>

    <task name="attach.databases">
      <dependencies list="unzip.databases,SetAccessRule,start.sqlexpress.service"/>
      <subtasks filename="vida.attach.databases.xml"/>
    </task>
    
    <task name="postinstall.lang">
      <description>
        Runs sql scripts in order to add necessary info to accessserver.
      </description>
      <dependencies list="start.sqlexpress.service,copy.dbutilities,attach.databases"/>
      <subtasks filename="vida.postinstall.xml"/>
    </task>

    <!--CR4117 added this so we run update scripts on the new database. Added specialy for script "Set_DB_Compatibility_100.sql"-->
    <task name="update.localdatabases">
      <dependencies list="postinstall.lang"/>
      <subtasks filename="vida.update.localdb.xml"/>
    </task>

    <task name="restart.vidamonitor">
      <dependencies list="postinstall.lang"/>
      <subtasks filename="vida.restart.xml"/>
    </task>
    
    
  </tasks>
  <events>
    <event name="ON_FINISH_OK">
      <subtasks filename="vida.finish.ok.xml">
      </subtasks>
    </event>

    <event name="ON_FINISH_FAILED">
      <subtasks filename="vida.finish.nok.xml">
      </subtasks>
    </event>

  </events>
  
</taskrunner>